package com.htyy.yutao.toptab;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.htyy.yutao.myapplication1.R;


/**
 * Created by Carson_Ho on 16/7/22.
 */
public class Fragment2 extends Fragment {
    private WebView wView;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater,
                             @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {

        View view= inflater.inflate(R.layout.fragment2, container, false);
        initView(view);
        return view;

    }

    public void initView(View view){
        wView = (WebView) view.findViewById(R.id.wView1);
        wView.loadUrl("https://cn.vuejs.org/");
        wView.setWebViewClient(new WebViewClient() {
            //在webview里打开新链接
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
    }

}
